package com.shinewing.sconlyoffice.dao;

import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Repository
public class UserDao {

    @Resource
    private JdbcTemplate jdbcTemplate;

    public Map<String, Object> findByName(String username) {
        String querySQL = "select SSUSER_USERNAME,SSUSER_EMPID  from SSUSER where SSUSER_USERNAME=?";
        Map<String, Object> map = jdbcTemplate.queryForMap(querySQL, new Object[]{username});
        return map;
    }

    public Map<String, Object> findByUid(String uid) {
        String querySQL = "select SSUSER_USERNAME,SSUSER_EMPID from SSUSER where SSUSER_empId=?";
        Map<String, Object> map = jdbcTemplate.queryForMap(querySQL, new Object[]{uid});
        return map;
    }

    public Map<String, Object> findById(String id) {
        String querySQL = "select SSUSER_USERNAME,SSUSER_EMPID from SSUSER where SSUSER_USERNAME=?";
        Map<String, Object> map = jdbcTemplate.queryForMap(querySQL, new Object[]{id});
        return map;
    }
}
